package com.study.model.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the pur_plan database table.
 * 
 */
@Entity
@Table(name = "pur_plan")
@NamedQuery(name = "PurPlan.findAll", query = "SELECT p FROM PurPlan p")
public class PurPlan implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "plan_id")
	private String planId;

	@Temporal(TemporalType.DATE)
	private Date plandate;

	private String planner;

	private String purtype;

	private String remarks;

	private String sourceform;

	private String sourceid;

	private int state;

	private String theme;

	// bi-directional many-to-one association to PurPlanDetail
	@OneToMany(mappedBy = "purPlan")
	private List<PurPlanDetail> purPlanDetails;

	public PurPlan() {
	}

	public String getPlanId() {
		return this.planId;
	}

	public void setPlanId(String planId) {
		this.planId = planId;
	}

	public Date getPlandate() {
		return this.plandate;
	}

	public void setPlandate(Date plandate) {
		this.plandate = plandate;
	}

	public String getPlanner() {
		return this.planner;
	}

	public void setPlanner(String planner) {
		this.planner = planner;
	}

	public String getPurtype() {
		return this.purtype;
	}

	public void setPurtype(String purtype) {
		this.purtype = purtype;
	}

	public String getRemarks() {
		return this.remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getSourceform() {
		return this.sourceform;
	}

	public void setSourceform(String sourceform) {
		this.sourceform = sourceform;
	}

	public String getSourceid() {
		return this.sourceid;
	}

	public void setSourceid(String sourceid) {
		this.sourceid = sourceid;
	}

	public int getState() {
		return this.state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getTheme() {
		return this.theme;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

	public List<PurPlanDetail> getPurPlanDetails() {
		return this.purPlanDetails;
	}

	public void setPurPlanDetails(List<PurPlanDetail> purPlanDetails) {
		this.purPlanDetails = purPlanDetails;
	}

	public PurPlanDetail addPurPlanDetail(PurPlanDetail purPlanDetail) {
		getPurPlanDetails().add(purPlanDetail);
		purPlanDetail.setPurPlan(this);

		return purPlanDetail;
	}

	public PurPlanDetail removePurPlanDetail(PurPlanDetail purPlanDetail) {
		getPurPlanDetails().remove(purPlanDetail);
		purPlanDetail.setPurPlan(null);

		return purPlanDetail;
	}

}